/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package consumo.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Carlos Taschetto
 */
@Entity
@Table(name = "cliente", catalog = "consumodb", schema = "")
@NamedQueries({
    @NamedQuery(name = "Cliente.findAll", query = "SELECT c FROM Cliente c"),
    @NamedQuery(name = "Cliente.findById", query = "SELECT c FROM Cliente c WHERE c.id = :id"),
    @NamedQuery(name = "Cliente.findByNome", query = "SELECT c FROM Cliente c WHERE c.nome = :nome"),
    @NamedQuery(name = "Cliente.findByCnpj", query = "SELECT c FROM Cliente c WHERE c.cnpj = :cnpj"),
    @NamedQuery(name = "Cliente.findByTipoende", query = "SELECT c FROM Cliente c WHERE c.tipoende = :tipoende"),
    @NamedQuery(name = "Cliente.findByEnde", query = "SELECT c FROM Cliente c WHERE c.ende = :ende"),
    @NamedQuery(name = "Cliente.findByFone", query = "SELECT c FROM Cliente c WHERE c.fone = :fone"),
    @NamedQuery(name = "Cliente.findByFax", query = "SELECT c FROM Cliente c WHERE c.fax = :fax"),
    @NamedQuery(name = "Cliente.findByEmail", query = "SELECT c FROM Cliente c WHERE c.email = :email"),
    @NamedQuery(name = "Cliente.findByContato", query = "SELECT c FROM Cliente c WHERE c.contato = :contato"),
    @NamedQuery(name = "Cliente.findByNuc", query = "SELECT c FROM Cliente c WHERE c.nuc = :nuc"),
    @NamedQuery(name = "Cliente.findByNum", query = "SELECT c FROM Cliente c WHERE c.num = :num"),
    @NamedQuery(name = "Cliente.findByCompl", query = "SELECT c FROM Cliente c WHERE c.compl = :compl"),
    @NamedQuery(name = "Cliente.findByBairro", query = "SELECT c FROM Cliente c WHERE c.bairro = :bairro"),
    @NamedQuery(name = "Cliente.findByUf", query = "SELECT c FROM Cliente c WHERE c.uf = :uf"),
    @NamedQuery(name = "Cliente.findByCidade", query = "SELECT c FROM Cliente c WHERE c.cidade = :cidade"),
    @NamedQuery(name = "Cliente.findByCep", query = "SELECT c FROM Cliente c WHERE c.cep = :cep")})
public class Cliente implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id", nullable = false)
    private Integer id;
    @Column(name = "nome", length = 100)
    private String nome;
    @Column(name = "cnpj", length = 20)
    private String cnpj;
    @Column(name = "tipoende", length = 10)
    private String tipoende;
    @Column(name = "ende", length = 100)
    private String ende;
    @Column(name = "fone", length = 13)
    private String fone;
    @Column(name = "fax", length = 13)
    private String fax;
    @Column(name = "email", length = 50)
    private String email;
    @Column(name = "contato", length = 100)
    private String contato;
    @Column(name = "nuc")
    private Integer nuc;
    @Column(name = "num")
    private Integer num;
    @Column(name = "compl", length = 45)
    private String compl;
    @Column(name = "bairro", length = 80)
    private String bairro;
    @Column(name = "uf", length = 3)
    private String uf;
    @Column(name = "cidade", length = 80)
    private String cidade;
    @Lob
    @Column(name = "obs", length = 65535)
    private String obs;
    @Column(name = "cep")
    private Integer cep;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cliente")
    private List<Contrato> contratoList;
    @JoinColumn(name = "grupo_clientes", referencedColumnName = "id", nullable = false)
    @ManyToOne(optional = false)
    private GrupoClientes grupoClientes;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cliente")
    private List<FaltaEnergia> faltaEnergiaList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cliente")
    private List<Leitura> leituraList;
    @Column(name = "nick_name", length = 50)
    private String nickName;

    public Cliente() {
    }

    public Cliente(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public String getCnpj() {
        return cnpj;
    }

    public void setCnpj(String cnpj) {
        this.cnpj = cnpj;
    }

    public String getTipoende() {
        return tipoende;
    }

    public void setTipoende(String tipoende) {
        this.tipoende = tipoende;
    }

    public String getEnde() {
        return ende;
    }

    public void setEnde(String ende) {
        this.ende = ende;
    }

    public String getFone() {
        return fone;
    }

    public void setFone(String fone) {
        this.fone = fone;
    }

    public String getFax() {
        return fax;
    }

    public void setFax(String fax) {
        this.fax = fax;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getContato() {
        return contato;
    }

    public void setContato(String contato) {
        this.contato = contato;
    }

    public Integer getNuc() {
        return nuc;
    }

    public void setNuc(Integer nuc) {
        this.nuc = nuc;
    }

    public Integer getNum() {
        return num;
    }

    public void setNum(Integer num) {
        this.num = num;
    }

    public String getCompl() {
        return compl;
    }

    public void setCompl(String compl) {
        this.compl = compl;
    }

    public String getBairro() {
        return bairro;
    }

    public void setBairro(String bairro) {
        this.bairro = bairro;
    }

    public String getUf() {
        return uf;
    }

    public void setUf(String uf) {
        this.uf = uf;
    }

    public String getCidade() {
        return cidade;
    }

    public void setCidade(String cidade) {
        this.cidade = cidade;
    }

    public String getObs() {
        return obs;
    }

    public void setObs(String obs) {
        this.obs = obs;
    }

    public Integer getCep() {
        return cep;
    }

    public void setCep(Integer cep) {
        this.cep = cep;
    }

    public List<Contrato> getContratoList() {
        return contratoList;
    }

    public void setContratoList(List<Contrato> contratoList) {
        this.contratoList = contratoList;
    }

    public GrupoClientes getGrupoClientes() {
        return grupoClientes;
    }

    public void setGrupoClientes(GrupoClientes grupoClientes) {
        this.grupoClientes = grupoClientes;
    }

    public List<FaltaEnergia> getFaltaEnergiaList() {
        return faltaEnergiaList;
    }

    public void setFaltaEnergiaList(List<FaltaEnergia> faltaEnergiaList) {
        this.faltaEnergiaList = faltaEnergiaList;
    }

    public List<Leitura> getLeituraList() {
        return leituraList;
    }

    public void setLeituraList(List<Leitura> leituraList) {
        this.leituraList = leituraList;
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Cliente)) {
            return false;
        }
        Cliente other = (Cliente) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "consumo.persistence.Cliente[id=" + id + "]";
    }

}
